var express = require('express');
var router = express.Router();
var request = require('request');

/* GET users listing. */
router.get('/login', function (req, res, next) {
    request('https://api.weixin.qq.com/sns/jscode2session?appid=wxdeaef6e3309bb34b&secret=9016aa1010f9ddc53ebc978e2db85f8a&js_code=' + req.query.code + '&grant_type=authorization_code',
        function (wxError, wxRes, wxResbody) {
            if (!wxError && wxRes.statusCode == 200) {
                // console.log(wxResbody) // 打印google首页
                res.status(200);
                res.json(wxResbody);
            }
        }
    );

});

module.exports = router;
